#include "stm32f10x.h"                  // Device header
#include "Delay.h"
#include "OLED.h"
#include "Time.h"

//我们想让定时器每秒自动帮我们加一下Num这个变量
uint16_t Num;
int main(void){
	OLED_Init();
	Time_Init();
	OLED_ShowString(1,3,"hello world!"); //如果超出16个字，会从头到尾重新输入
	OLED_ShowString(2,3 ,"Num:");
	while(1){
		OLED_ShowNum(2,7,Num,5);
		OLED_ShowNum(3,7,TIM_GetCounter(TIM2),5);
	}
}
void TIM2_IRQHandler(void){
	//判断标志位是否存在
	if(TIM_GetITStatus(TIM2,TIM_IT_Update)==SET){
		Num++;
		TIM_ClearITPendingBit(TIM2,TIM_IT_Update);
	}
}